Added back internal invariant checking.