Fix survey state query in message handler