fixed: UnboundLocalError