Fixed a crash caused by an ArrayIndexOutOfBounds exception in the loops
that sort words to add/remove if there were only words to add or only
words to remove.