Atlas bugfix: Leaking global var and incorrect var name