Fix marshalling code to properly handle string types.