Remove some unreachable (and wrong) code and replace it with an assertion.