Added missing cleanup code for deletion