crash fix when changing selection