fixed bug in hw2