fixed bug, toArray = problem