error in delete logic