Updated length to work for 32 bit machines too