replace exceptions with asserts