added list of undefined variable to exception that is raised in this case