move query back to global