Tentative fix for big-endian machine issue.

The solution has been kindly provided by Andrew Maclean.

Change-Id: I16d98c2c2413ad9d9367a224c1f6e2a7d31f0873