Fix some problems with asserts