Fixed call by reference errors