Fixed bug in selection