fixed an issue with undeclared variable