Fix the constraint check ordering