Fix problems with multiple queries