fix undefine issues.