Sort names by number

Fixes bug #1369794: if machine names are numbers then sort them as numbers.
I've updated this comment, hopefully it's a bit clearer.