Fix Agent submit message encoding