Fix animation state change logic