a new function for correcting HB