Use RuntimeError instead of asserts

I am not quite sure why ``assert`` is used, raising an exception that means what it means (an error happening at runtime) is IMHO much clearer than just a plain ``AssertionError``.