Fix some byte-ordering issues and things.