Fixed bugs in the ForeignKey importer