fixed; global var leak

fixes #1803