Fix numeric data values not being correctly encoded

Pulled from the original source.