fix serious bug with libhsm