Change XEngine to call StateChange rather than RemoveScript on state changes