fixed reference bugs