Check the undefined variables and fix it.