Changed behaviour of error handling
Fixed #161