Fix bug with relations.