title: AppleScript texting app messages the wrong person
body: <p>I have this script that sends multiple text messages, but sometimes the script will send the first message to another number that I've recently messaged in Messages. I can't seem to find a pattern either, sometimes the bug happens and sometimes it sends all of the texts to the right number. </p>
  
  <pre><code>--usage: osascript sendMessage phone_number text_to_send amount_to_send
  --Sends targetMessage to targetBuddyPhone repeatAmount times to targetMessage   
  
  on run {targetBuddyPhone, targetMessage, repeatAmount}
      set counter to 0
      repeat while counter &lt; repeatAmount
          tell application "Messages"
              send targetMessage to buddy targetBuddyPhone of service "SMS"
              set counter to counter + 1
          end tell
      end repeat
  end run
  </code></pre>
  
  <p>How can I fix this?</p>