fix for john's varcalc problem, with test