Fixed variable undefined issue.