fix unbound local error