fix algoritm recognize