Fixed ref rather than copy problem