Endianess patch by Forrest