add some more asserts, and fix test case for debug which was broken by all the assserts slowing it down