Fix some regressions picked up by asserts