Fixing a bug with selecting