Adding missing referential integrity