Bugfix, variable out of scope