fixed order of constraints problem better by adding another check for atomicity