* Update core.py - save mask when edited
In order to facilitate the `restore_mask` functionality better, one needs to save the mask to the cache when the mask is edited.
* Update core.py - add missing unsqueeze(0)
mask cache was missing unsqueeze function, giving the resulting mask the wrong size.