Return empty array for empty array (fixes some crashes)