Modmanager removing duplicates: Use a standard looping pattern.

This is hopefully easier to understand and this piece of code is not
critical for performance, so let's just have it written as easy as possible.
Found the bug! This line should be:
```
if (ret[i] == ret[j]) {
```