correct errors in brute force