Fixed reference bugs.