Fixes to cascade of foreign keys