fixed bug animation loop