fix some bugs in hw