Fixed bug where memcpy was copying bytes in the wrong order. Set bitfield lengths to the right values.