fixed pass by value problem