made the select_optional collectorr more robust