Escape xml invalid character in check_conditions function