Fixes issue #15 and fixes issue #14