Fixed Foreign Key Bug