Fixed inconsistencies with setting old attributes and pks

issue #2892