Important fix to provide operation with different sorting modes.