Fix conversions between []byte and string

These need to store the copy in the returned data structure, not the original.