Some code clean and bug fix