Fixed: was passing reference to local variable.