 		       (trace ["update-rhs - alteration - rejected" old-rhs new-rhs])
 		       [old-lhs-index old-rhs-index old-insertions old-alterations old-deletions])))
 		 (let [new-rhs-entry (RHSEntry. new-rhs initial-lhs-pks)
-		       new-rhs-index (assoc old-rhs-index rhs-pk new-rhs-entry)]
+		       new-rhs-index (map-put old-rhs-index rhs-pk new-rhs-entry)]
 		   (trace ["update-rhs - insertion" new-rhs])
 		   [old-lhs-index new-rhs-index old-insertions old-alterations old-deletions]))))
 	   [old-lhs-index old-rhs-index nil nil nil]

	    (let [old-rhs-index (old-rhs-indeces-2 i)
		  ;; remove lhs from old-rhs-pks (if necessary) - TODO - tidy up
		  dummy (trace ["old-rhs-pk" old-rhs-pk old-rhs-index])
		  tmp-rhs-index (if-let [^RHSEntry old-old-rhs-entry (old-rhs-index old-rhs-pk)]
				  (let [old-lhs-pks (.lhs-pks old-old-rhs-entry)
					new-lhs-pks (assoc old-lhs-pks j (disj (old-lhs-pks j) lhs-pk))
					new-old-rhs-entry (RHSEntry. (.rhs old-old-rhs-entry) new-lhs-pks)
					dummy (trace ["new-old-rhs-entry" new-old-rhs-entry])
					tmp-rhs-index (assoc old-rhs-index old-rhs-pk new-old-rhs-entry)]
				    tmp-rhs-index)
				  old-rhs-index)
		  ;; add lhs to new-rhs-pks
		  [rhs new-rhs-index] (if delete ;we have already deleted rhs backptrs - do no more
					[nil tmp-rhs-index]
					(let [^RHSEntry old-new-rhs-entry (tmp-rhs-index new-rhs-pk)
					    [rhs old-lhs-pks] (if old-new-rhs-entry
								[(.rhs old-new-rhs-entry) (.lhs-pks old-new-rhs-entry)]
								[nil

   [org.dada.core counted-set utils]
   )
  (:import
   [java.util Collection HashMap Map]
   [org.dada.core Attribute Data Getter Metadata Metadata$VersionComparator Model RemoteModel Tuple Update View]
   )
  (:gen-class
