Fixed issue #34 and issue #38
Merge pull request #39 from agg23/master

Fixed issue #34 and issue #38