Fixed encoding for little-endian machines (like linux and mac os x)

This fixes issue #174