adding error handling fix #1
Merge pull request #2 from tristantao/add_error_handling

adding error handling fix #1