better initialization of array

(cherry picked from commit cca8400538681e879553733149abc1424786887d)