fix UnboundLocalError in interactive mode