[algorithms] fixing bug when selecting  under grad filter