fixed issue when adding foreign key