Fixed bug in selection method