A few fixes to some byte swap functions.
I'm not happy with the way it's done, though.