fixed bug with check of anagram logic