Fix variable undefined errors.