Fix defect with key handling in query tool.