Demonstration of unexpected behavior with roles and variable scope