updated tests, fix a pass by reference issue