Quick fix for sms method
diff --git a/interpreter/core/computer/calendar/calendar.py b/interpreter/core/computer/calendar/calendar.py
index 86ad36912..4c39797b4 100644
--- a/interpreter/core/computer/calendar/calendar.py
+++ b/interpreter/core/computer/calendar/calendar.py
@@ -30,7 +30,16 @@ def get_events(self, start_date=datetime.date.today(), end_date=None):
         script = f'''
         set theDate to date "{applescript_start_date}"
         set endDate to date "{applescript_end_date}"
-
+        tell application "System Events"
+            set calendarIsRunning to (name of processes) contains "{self.calendar_app}"
+            if calendarIsRunning then
+                tell application "{self.calendar_app}" to activate
+            else
+                tell application "{self.calendar_app}" to launch
+                delay 1 -- Wait for the application to open
+                tell application "{self.calendar_app}" to activate
+            end if
+        end tell
 
         set outputText to ""
 
@@ -159,6 +168,17 @@ def create_event(self, title: str, start_date: datetime.datetime, end_date: date
                 return "Can't find a default calendar. Please try again and specify a calendar name."
             
         script = f'''
+        -- Open and activate calendar first
+        tell application "System Events"
+            set calendarIsRunning to (name of processes) contains "{self.calendar_app}"
+            if calendarIsRunning then
+                tell application "{self.calendar_app}" to activate
+            else
+                tell application "{self.calendar_app}" to launch
+                delay 1 -- Wait for the application to open
+                tell application "{self.calendar_app}" to activate
+            end if
+        end tell
         tell application "{self.calendar_app}"
             tell calendar "{calendar}"
                 set startDate to date "{applescript_start_date}"
@@ -196,6 +216,17 @@ def delete_event(self, event_title: str, start_date: datetime.datetime,  calenda
         # Format datetime for AppleScript
         applescript_start_date = start_date.strftime('%B %d, %Y %I:%M:%S %p')
         script = f'''
+        -- Open and activate calendar first
+        tell application "System Events"
+            set calendarIsRunning to (name of processes) contains "{self.calendar_app}"
+            if calendarIsRunning then
+                tell application "{self.calendar_app}" to activate
+            else
+                tell application "{self.calendar_app}" to launch
+                delay 1 -- Wait for the application to open
+                tell application "{self.calendar_app}" to activate
+            end if
+        end tell
         tell application "{self.calendar_app}"
             -- Specify the name of the calendar where the event is located
             set myCalendar to calendar "{calendar}"
@@ -237,6 +268,14 @@ def get_first_calendar(self) -> str:
         
         # Literally just gets the first calendar name of all the calendars on the system. AppleScript does not provide a way to get the "default" calendar
         script = f"""
+            -- Open calendar first
+            tell application "System Events"
+                set calendarIsRunning to (name of processes) contains "{self.calendar_app}"
+                if calendarIsRunning is false then
+                    tell application "{self.calendar_app}" to launch
+                    delay 1 -- Wait for the application to open
+                end if
+            end tell
             tell application "{self.calendar_app}"
             -- Get the name of the first calendar
                 set firstCalendarName to name of first calendar
diff --git a/interpreter/core/computer/contacts/contacts.py b/interpreter/core/computer/contacts/contacts.py
index 61612d174..890c0dc95 100644
--- a/interpreter/core/computer/contacts/contacts.py
+++ b/interpreter/core/computer/contacts/contacts.py
@@ -30,7 +30,8 @@ def get_phone_number(self, contact_name):
                 # Language model friendly error message
                 return f"A contact for '{contact_name}' was not found, perhaps one of these similar contacts might be what you are looking for? {names} \n Please try again and provide a more specific contact name."
         else:
-            return stout
+            return stout.replace('\n', '')
+
 
     def get_email_address(self, contact_name):
         """
@@ -56,7 +57,7 @@ def get_email_address(self, contact_name):
                 # Language model friendly error message
                 return f"A contact for '{contact_name}' was not found, perhaps one of these similar contacts might be what you are looking for? {names} \n Please try again and provide a more specific contact name."
         else:
-            return stout
+            return stout.replace('\n', '')
 
 
     def get_full_names_from_first_name(self, first_name):
diff --git a/interpreter/core/computer/mail/mail.py b/interpreter/core/computer/mail/mail.py
index 051de95ce..b5c2e97e7 100644
--- a/interpreter/core/computer/mail/mail.py
+++ b/interpreter/core/computer/mail/mail.py
@@ -1,3 +1,4 @@
+import os
 import re
 import subprocess
 import platform
@@ -17,6 +18,10 @@ def get(self, number=5, unread: bool = True):
         if platform.system() != 'Darwin':
             return "This method is only supported on MacOS"
         
+        too_many_emails_msg = ""
+        if number > 50:
+            number = min(number, 50)
+            too_many_emails_msg = "This method is limited to 10 emails, returning the first 10: "
         # This is set up to retry if the number of emails is less than the number requested, but only a max of three times
         retries = 0  # Initialize the retry counter
         while retries < 3:
@@ -45,10 +50,10 @@ def get(self, number=5, unread: bool = True):
                         continue
                 break
             elif stdout:
-                print(stdout)
-                return stdout
-            break
-        return None  # Return None if the operation fails after max_retries
+                if too_many_emails_msg:
+                    return f"{too_many_emails_msg}\n\n{stdout}"
+                else:
+                    return stdout
 
     def send(self, to, subject, body, attachments=None):
         """
@@ -57,11 +62,24 @@ def send(self, to, subject, body, attachments=None):
         if platform.system() != 'Darwin':
             return "This method is only supported on MacOS"
         
+        # Strip newlines from the to field
+        to = to.replace("\n", "")
+        
         attachment_clause = ''
+        delay_seconds = 5  # Default delay in seconds
+        
         if attachments:
+            formatted_attachments = [self.format_path_for_applescript(path) for path in attachments]
+
             # Generate AppleScript to attach each file
-            attachment_clause = '\n'.join(f'make new attachment with properties {{file name:"{path}"}} at after the last paragraph of the content of new_message' for path in attachments)
+            attachment_clause = '\n'.join(f'make new attachment with properties {{file name:{path}}} at after the last paragraph of the content of new_message' for path in formatted_attachments)
+
+            
             
+            # Calculate the delay based on the size of the attachments
+            delay_seconds = self.calculate_upload_delay(attachments)
+
+        print(f"Delaying for {delay_seconds} seconds")
         # In the future, we might consider allowing the llm to specify an email to send from
         script = f'''
         tell application "{self.mail_app}"
@@ -71,6 +89,7 @@ def send(self, to, subject, body, attachments=None):
                 make new to recipient at end of to recipients with properties {{address:"{to}"}}
                 {attachment_clause}
             end tell
+            {f'delay {delay_seconds}' if attachments else ''}
             send new_message
         end tell
         '''
@@ -82,19 +101,46 @@ def send(self, to, subject, body, attachments=None):
 
     def unread_count(self):
             """
-            Retrieves the count of unread emails in the inbox.
+            Retrieves the count of unread emails in the inbox, limited to 50.
             """
             if platform.system() != 'Darwin':
                 return "This method is only supported on MacOS"
             
             script = f'''
             tell application "{self.mail_app}"
-                return count of (messages of inbox whose read status is false)
+                set unreadMessages to (messages of inbox whose read status is false)
+                if (count of unreadMessages) > 50 then
+                    return 50
+                else
+                    return count of unreadMessages
+                end if
             end tell
             '''
             try:
-                return int(run_applescript(script))
+                unreads = int(run_applescript(script))
+                if unreads >= 50:
+                    return "50 or more"
+                return unreads
             except subprocess.CalledProcessError as e:
                 print(e)
                 return 0
 
+    # Estimate how long something will take to upload
+    def calculate_upload_delay(self, attachments):
+        try:
+            total_size_mb = sum(os.path.getsize(att) for att in attachments) / (1024 * 1024)
+            # Assume 1 MBps upload speed, which is conservative on purpose
+            upload_speed_mbps = 1  
+            estimated_time_seconds = total_size_mb / upload_speed_mbps
+            return round(max(0.2, estimated_time_seconds + 1), 1)  # Add 1 second buffer, ensure a minimum delay of 1.2 seconds, rounded to one decimal place
+        except:
+            # Return a default delay of 5 seconds if an error occurs
+            return 5
+        
+        
+    def format_path_for_applescript(self, file_path):
+        # Escape backslashes, quotes, and curly braces for AppleScript
+        file_path = file_path.replace('\\', '\\\\').replace('"', '\\"').replace('{', '\\{').replace('}', '\\}')
+        # Convert to a POSIX path and quote for AppleScript
+        posix_path = f'POSIX file "{file_path}"'
+        return posix_path
\ No newline at end of file
diff --git a/interpreter/core/computer/sms/sms.py b/interpreter/core/computer/sms/sms.py
index ebe823d3d..4a811c3e0 100644
--- a/interpreter/core/computer/sms/sms.py
+++ b/interpreter/core/computer/sms/sms.py
@@ -18,6 +18,8 @@ def send(self, to, message):
         if platform.system() != 'Darwin':
             return "This method is only supported on MacOS"
         
+        # Remove any newline characters from the recipient number.
+        to = to.replace("\n", "")
         # Escape double quotes in the message and recipient variables to prevent script errors.
         escaped_message = message.replace('"', '\\"')
         escaped_to = to.replace('"', '\\"')

### Describe the changes you have made:

Prevents newline characters from breaking computer.sms.send

### Reference any relevant issues (e.g. "Fixes #000"):

### Pre-Submission Checklist (optional but appreciated):

- [ ] I have included relevant documentation updates (stored in /docs)
- [x] I have read `docs/CONTRIBUTING.md`
- [x] I have read `docs/ROADMAP.md`

### OS Tests (optional but appreciated):

- [ ] Tested on Windows
- [x] Tested on MacOS
- [ ] Tested on Linux
