correct foreign keys for all tables