byteLength to length conversion fix