Fixed issue #2

exception handling