Added some debug output to events query