fix collision bug and other cleaning