Many bug fixes, including selection fixes.