Fix #25 and better overall exception handling.