fixed select function