some changes and bug fix