fixes issue #20 and #19