Fixed findSolution function.