Fixed bug to have encoding with correct endian