Parts of "Fix various broken bits from the rebase"

Change-Id: I2db072751de7d4e583594774b1bfa0c2a65ebf8a