fixing bug in select