fixing syntax issue on event loops