update foreign keys