avoid crash if an empty slice is given