fixing bugs in HBM