Mark foreign key fields dirty on assignment, fixes #389