Fixed crash if list is empty