fix closest selection for empty buffer