Fix the undefined variable issue