Fix undefined variable bug.