Fixed sorting bug in option generation.

The sorting of the options were done using strings, instead of integers,
which caused some weird problems in serializing.