fixed #4169562367585 #4169562367589 better error handling
Merge pull request #27 from ordrin/dev_ricky

fixed #4169562367585 #4169562367589 better error handling