Fixed formatArray when the array is empty