Fixing calls of ->to_array to ->toArray