Some bug fixes/assertions.