Added asserts a a few places.