Now sorts records correctly