fixed return by reference register error