fixed passing by reference error