Fix state saving when it happens during an animation