fixed bug with deleting the first layer