Null pointer exception when creating average value - continuing investigation