Fix conditional ordering