fixed pass by value problem - maybe not for arrays yet though