bugfix : crash after removal of the mask layer