[Fixed] Variables with Multiple Scopes

Variable names are now correctly detected when copying, even if the variable has multiple scopes.