Further improvements to sorting thanks to euqip https://github.com/emoncms/emoncms/issues/245