replace throws with asserts