#1985280: Fixed issue with hook_entity_update() foreach loop. #1495716/#1986472: Fixed issue with D6 -> D7 upgrade path.