fixed recursive merge for array