fix unbound variable error