Fixes cms:layout sometimes adding extra items at the end when the list contains nulls.