fix order clause checking