Made more fault tolerant and gave more explicit error message.
Merge pull request #14 from blink1073/master

Made more fault tolerant and gave more explicit error message.