Made the array formula expansion more robust to mismatched array sizes