Fixing tests and serialisation reference table in ForeignKey definitions.