fix issues #34 and #37