Correct types in exception handling. Closes #8