handle empty arrays