Add endian check logic