added message validation on write