bug fix in hw4