deal with empty arrays better