added a correction for values of hp approximately zero