wrong looping for token generation homographic check