Remove infinite loop in solver