make query mode work