error handling for delete