Fix error with foreign key ID in relations.