fix issues #10 #8 #5 #4