before sending messages