Fixed scripting for foreign key.