fix gaia thread and event bugs