Fix instances query