fix secondary sort