Added more expressive asserts to solve a bug.