Fix corner case of arrays of length zero