Custom function after selection and empty list switch + bugfix