Fix issue #17 and #19