fixed another issue with scope and wrong variable calls