Adding more checks into Solve and fixing a corresponding mistake in a driver.