extend integration tests and fix queries