Handle query reply