Fix selection bugs.