bug fixes in delete