fix errors foreign keys