addd code to ensure that selection handled