Exception handling, bug fixes.