fixed pass by reference error