fixes reference bugs; #11