Fix bug in delete method