Related data constraint fixes

I don't know why yet, but polymorphism does not seem to work well without it.