Plug memory leak in rebuildSelector.