Handling query msgs.