fixed foreign key issue