Fixes error removing a layer that doesn't exist