Fixes to HMM to add reference padding.