Improved handling of relations.