Added query calls from multithreaded context.