fix bug: referenced undefined variable