A few bug fixes for delete