Fixed a bug that stopped after hex conversion

Conversion would stop after returning to hex value, because of a wrong
string length assumption.