fixed a potential optimizer issue with asserts on gcc/clang