Correct some bugs and:

sign end message with “\r\n”