Fix invariant issues.