Update selection helpers and fix selection trim.