fix error handling
merge master
fixed more error handling issues
Merge pull request #39 from georgexzeng/master

fix error handling