Fix the type in metadata, but still use string type in network packets. (cherry picked from commit 47c6f5b7)