Fixed exception handling
Fixed exception handling