Fix bruteforce solution