Fixed a bug in the array conversion. I used array_walk but array_map was more appropriate.