fixed bugs,  #48 #46 #47 #49 #50