consider scope when checking variablename
Added scope check to declaration test