thanks jj-zhuang pointer out bugs