Plugins cannot really substitute underlying chord/rests
1- Use a plugin which creates a new score, for example the "new score", "random", "random 2" plugins.
2- Check with the debugger the segment at the beginning of each measure: a leftover measure rest is present behind the written chord, see attached image (made with the "random" plugin).
It seems that the cursor.addNote function does not delete the previously present measure rest, but adds a chord on top of that.
This can possibly lead to a corruption of the score.
Windows 8.1, Musescore 2.0.2 & commit d08e14cc3