Fixed xml rules, added <when> when was needed