Added patch from @pasis for big endian architectures