Fix issue #30 and issue #31
Merge pull request #33 from willynilly/issue_30

Fix Issue #30 and issue #31