Correctly handle empty slice