some fixes to regression calc