fixed unbound local error