Fixed Issue #71

Fixed broken error handling