mm: Fix removing duplicate items from array
We were blindly iterating over the array even when an item was removed, thus skipping an item to be compared in those cases.
Instead, skip only when we haven't removed an item, so that all items in the array are checked.
Also add a test to sms-uri so that we won't break this again