Fix incorrect order detection.