I think you accidentally made `query` a global.