Some fix and paste. Use putchar instead a write in protocol module.