make text protocol more robust