Fixed a bug with relationships