fix undeclared variable assignment