diff --git a/compiler/copyprop.lisp b/compiler/copyprop.lisp
index 124a40604f9c8cc65941d97a1030ad56062e3cd2..cc75699e9599aa8d4029db4ed3166df725202ffc 100644
--- a/compiler/copyprop.lisp
+++ b/compiler/copyprop.lisp
@@ -166,8 +166,9 @@
 	   (return nil)))
        (let ((info (vop-info vop)))
 	 (not (and (eq (vop-info-move-args info) :local-call)
-		   (>= (position-in #'tn-ref-across arg (vop-args vop)
-				    :key #'tn-ref-tn)
+		   (>= (or (position-in #'tn-ref-across arg (vop-args vop)
+					:key #'tn-ref-tn)
+			   (error "Couldn't find REF?"))
 		       (length (template-arg-types info))))))))
 
 
diff --git a/compiler/represent.lisp b/compiler/represent.lisp
index d523a4461e75be23d00be7c6fc42596119b30b5f..79c2b8c43171648d09490bc1718e7d83a16237ec 100644
--- a/compiler/represent.lisp
+++ b/compiler/represent.lisp
@@ -47,7 +47,10 @@
 		 ((null costs)
 		  (assert more-cost)
 		  (values arg-p
-			  (+ n (position-in #'tn-ref-across ref refs) 1)
+			  (+ n
+			     (or (position-in #'tn-ref-across ref refs)
+				 (error "Couldn't find REF?"))
+			     1)
 			  t
 			  more-cost
 			  nil