fixed an issue with passing by reference.