Fixed the events query