multiple fixes from lucas
Most of the noise here is due to renaming Variable.getTypeValue()
to Variable.getType()
Also test case improvements, thanks much