added code to fix selection