fixed issues #19 and #17