fix race condition with animation