replace asserts by reliable exceptions
adjusted debug levels