Fix open queries