if-else when deleting