Fix foreign keys