Fix undefined variables

close #201