Fix Issue #13 using exception handling.
Merge pull request #14 from nickvirag/fix-issue-13

Fix Issue #13 using exception handling.