Bug fixes on big-endian machines