Really documents are ordered by text correctly 0X always come before 1X the problem is that you have not normalized the number with a fix number of digits, the way to solve this kind of problems ( at least one way ) is to work always with a fixed number of digits, for example 5, and then 01->00001 100->00100 etc... and in this scenario the ordering will going right.
The other solution is change source code to implement other logic for ordering ( I you case I think the more easy is normalize the number unifying the format ).