fixes to avg in jmGen.py