fix issue #7
fix issue #6
fix issue #5