fixed issues when try and debug issue #19 and issue #15.