fixed the message function