fix byte swapping problems in header