fixes to source variable name tracking, and new test to verify fix