fixing reference error