Fixed issue #34 and issue #38