Bugfixing - undefined variable