fix major bug which was spawning several event loops