fix issue with trying to select from an empty list.