Fixed Issue 98

Added some improved error handling and fixed issue #98