Fix assertion errors