Fixed key not found exception caused by wrong insert position

The indices of _capabilityHeader._data and _capabilityHeader.controlWidget get out of sync when new items get inserted, causing 'key not found' exceptions in line 425.