Fixed up sendAndWaitForReply to actually wait for the reply.