Fix indexing of relationships