Fix several bugs on 64-bit big endian architectures See merge request !40
Mentioned in commit 4e212d9a