fixed some bugs in hw8