Fixed bugs with relationships.