Fix StateAnim lifetime bug (#563)