Fixed bugs when selecting.