fixed bug, moved global var from class to module scope