Only convert array if needed

(cherry picked from commit 84355f6d1c416acc5776e6f9023ff04fcc538cd6)