Fixed code for 0-sized collections