Bug fix on undeclared variable