Fixes issue #9 and issue #10