fixed a bug  and more