update tests, refactor exception handling a bit