return unless $data = &valid_username($data);
 
     ¬ice("Logging out $data...");
-    $twits{$data}->end_session();
+    eval {
+        $twits{$data}->end_session();
+    };
     delete $twits{$data};
     undef $twit;
     if ( keys %twits ) {
             }
 
             unless ( $twit->authorized ) {
+                eval {
+                    my $url = $twit->get_authorization_url;
+                };
+
+                if ($@) {
+                    ¬ice("ERROR: Failed to get OAuth authorization_url.  Try again later.");
+                    return;
+                }
+
                 ¬ice("Twirssi not autorized to access $service for $user.");
                 ¬ice("Please authorize at the following url, then enter the pin ");
-                ¬ice("supplied with /twirssi_oath $user\@$service <pin>");
-                ¬ice($twit->get_authorization_url);
+                ¬ice("supplied with /twirssi_oauth $user\@$service <pin>");
+                ¬ice($url);
 
                 $oauth{pending}{"$user\@$service"} = $twit;
                 return;
 
     my $store_file = Irssi::settings_get_str("twirssi_oauth_store");
     if ($store_file) {
-        my %store;
+        my @store;
         if ( open( OAUTH, $store_file ) ) {
             while (<OAUTH>) {
                 chomp;
-                my ( $k, $v ) = split ' ', 2;
-                $store{$k} = $v;
+                next if /$key/i;
+                push @store, $_;
             }
             close OAUTH;
 
         }
 
-        $store{$key} = "$access_token $access_token_secret";
+        push @store, "$key $access_token $access_token_secret";
 
         if ( open( OAUTH, ">$store_file.new" ) ) {
-            print OAUTH "$_ $store{$_}\n" foreach keys %store;
+            print OAUTH "$_\n" foreach @store;
             close OAUTH;
             rename "$store_file.new", $store_file
               or ¬ice("Failed to rename $store_file.new: $!");
 sub do_updates {
     my ( $fh, $username, $obj, $cache ) = @_;
 
-    my $rate_limit = $obj->rate_limit_status();
-    if ( $rate_limit and $rate_limit->{remaining_hits} < 1 ) {
-        ¬ice("Rate limit exceeded for $username");
-        return undef;
-    }
+    eval {
+        my $rate_limit = $obj->rate_limit_status();
+        if ( $rate_limit and $rate_limit->{remaining_hits} < 1 ) {
+            ¬ice("Rate limit exceeded for $username");
+            return undef;
+        }
+    };
 
     print scalar localtime, " - Polling for updates for $username" if &debug;
     my $tweets;
         }
     }
 
-    if (    my $autouser = Irssi::settings_get_str("twitter_usernames")
-        and my $autopass = Irssi::settings_get_str("twitter_passwords") )
-    {
+    if ( my $autouser = Irssi::settings_get_str("twitter_usernames") ) {
         &cmd_login();
         &get_updates;
     }