Fixed major bug causing asserts on runtime checking