Fix flicker in animation