Fix indexMaxComponent and use transaction to update it