Fix protocol write issue on clang