fix relations of tables