Ensure fk constraint is added, fixes #474.