fixing a small bug in the conditions on when to write "make-ref"