Fix bug where classifications weren't sorted correctly