fix bugs to make animations work as expected