bug fix and optimise animation