Fixed bug in sort serialization