Fixing a bug in byteLength in case encoding == 'hex'