correct scope for return variable