fix issue #37
fix issue #40
fix for issue #40