fix typo and reorder clauses