fixes for delete function