Bug in toArray Conversion forgot to increment index