Fixed undefined variable bug.