Fix foreign key creation