Second step of sort correction