improve type and endian safety
fix mspsim endianess