handle nil and array responses