Improve Exception Handling
Fix a couple of bugs