Fix by Robert Wall as discussed http://openenergymonitor.org/emon/node/5649
Fix by Robert Wall as discussed http://openenergymonitor.org/emon/node/5649