Fixes to delete functionality