Fix sort issues with multiple sort fields