Fixed multiple foreign key problems.