write message properly