diff --git a/src/com/android/email/mail/store/ImapFolder.java b/src/com/android/email/mail/store/ImapFolder.java
index 5564223..5d49b01 100644
--- a/src/com/android/email/mail/store/ImapFolder.java
+++ b/src/com/android/email/mail/store/ImapFolder.java
@@ -757,7 +757,7 @@
 
                 } else {
                     if (e.isString()) {
-                        mp.setSubType(bs.getStringOrEmpty(i).getString().toLowerCase());
+                        mp.setSubType(bs.getStringOrEmpty(i).getString().toLowerCase(Locale.US));
                     }
                     break; // Ignore the rest of the list.
                 }
@@ -782,7 +782,7 @@
             final ImapString type = bs.getStringOrEmpty(0);
             final ImapString subType = bs.getStringOrEmpty(1);
             final String mimeType =
-                    (type.getString() + "/" + subType.getString()).toLowerCase();
+                    (type.getString() + "/" + subType.getString()).toLowerCase(Locale.US);
 
             final ImapList bodyParams = bs.getListOrEmpty(2);
             final ImapString cid = bs.getStringOrEmpty(3);
@@ -840,7 +840,7 @@
 
             if (bodyDisposition.size() > 0) {
                 final String bodyDisposition0Str =
-                        bodyDisposition.getStringOrEmpty(0).getString().toLowerCase();
+                        bodyDisposition.getStringOrEmpty(0).getString().toLowerCase(Locale.US);
                 if (!TextUtils.isEmpty(bodyDisposition0Str)) {
                     contentDisposition.append(bodyDisposition0Str);
                 }
@@ -854,9 +854,9 @@
                     for (int i = 1, count = bodyDispositionParams.size(); i < count; i += 2) {
 
                         // TODO We need to convert " into %22.  See above.
-                        contentDisposition.append(String.format(";\n %s=\"%s\"",
+                        contentDisposition.append(String.format(Locale.US, ";\n %s=\"%s\"",
                                 bodyDispositionParams.getStringOrEmpty(i - 1)
-                                        .getString().toLowerCase(),
+                                        .getString().toLowerCase(Locale.US),
                                 bodyDispositionParams.getStringOrEmpty(i).getString()));
                     }
                 }
@@ -865,7 +865,7 @@
             if ((size > 0)
                     && (MimeUtility.getHeaderParameter(contentDisposition.toString(), "size")
                             == null)) {
-                contentDisposition.append(String.format(";\n size=%d", size));
+                contentDisposition.append(String.format(Locale.US, ";\n size=%d", size));
             }
 
             if (contentDisposition.length() > 0) {
diff --git a/src/com/android/email/mail/store/Pop3Store.java b/src/com/android/email/mail/store/Pop3Store.java
index b3ee420..407d47e 100644
--- a/src/com/android/email/mail/store/Pop3Store.java
+++ b/src/com/android/email/mail/store/Pop3Store.java
@@ -48,6 +48,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Locale;
 
 public class Pop3Store extends Store {
     // All flags defining debug or development code settings must be FALSE
@@ -786,13 +787,19 @@
             int messageId = mUidToMsgNumMap.get(message.getUid());
             if (lines == -1) {
                 // Fetch entire message
-                response = executeSimpleCommand(String.format("RETR %d", messageId));
+                response = executeSimpleCommand(String.format(Locale.US, "RETR %d", messageId));
             } else {
                 // Fetch partial message.  Try "TOP", and fall back to slower "RETR" if necessary
                 try {
-                    response = executeSimpleCommand(String.format("TOP %d %d", messageId,  lines));
+                    response = executeSimpleCommand(
+                            String.format(Locale.US, "TOP %d %d", messageId,  lines));
                 } catch (MessagingException me) {
-                    response = executeSimpleCommand(String.format("RETR %d", messageId));
+                    try {
+                        response = executeSimpleCommand(
+                                String.format(Locale.US, "RETR %d", messageId));
+                    } catch (MessagingException e) {
+                        Log.w(Logging.LOG_TAG, "Can't read message " + messageId);
+                    }
                 }
             }
             if (response != null)  {
@@ -846,8 +853,16 @@
             }
             try {
                 for (Message message : messages) {
-                    executeSimpleCommand(String.format("DELE %s",
-                            mUidToMsgNumMap.get(message.getUid())));
+                    try {
+                        final String uid = message.getUid();
+                        final int msgNum = mUidToMsgNumMap.get(uid);
+                        executeSimpleCommand(String.format(Locale.US, "DELE %s", msgNum));
+                        // Remove from the maps
+                        mMsgNumToMsgMap.remove(msgNum);
+                        mUidToMsgNumMap.remove(uid);
+                    } catch (MessagingException e) {
+                        // A failed deletion isn't a problem
+                    }
                 }
             }
             catch (IOException ioe) {
