fix for #1

fix for #2
fix for #3

fix for #4