fix issue #14 and #16