solving invalid message problem