Fix for Rubinius

It seems to break when modifying the array it’s
looping over. Besides, this way is cleaner.