Better checking of numeric values when quoting.

This prevents strings that are also numbers from being used as a number in the analytics commands. Thanks to @gauthierm for pointing it out.