hacky solution to save selection, fix nil error in search with .compact