Fix animation replay loop bug