make sure the correct layer gets removed