Fix bugs with the layout of Capabilities struct