BD: Fixes in foreigns keys