hw2.2 bug fix to delete last record