Fix issue #2550
added tests for new feature
Merge pull request #2731 from bfroehle/rpush_local_scope

%Rpush: Look for variables in the local scope first.