fix variable undefine error