fixed foreign key contraint issue