checking the array before merge