replace assertion by check...

... to enable checking also when compiled in Release mode.