fixed passing by reference