Fix bug in delete