Errorhandling

re-enable error handling.
This will fix issue #8 .

However, these err handling makes mess a little. Refactoring is required in the future.