Fix sorting of class numbers. Fixes #52