fix bugs #19 #14  #4