Fix problem with detecting exceptions in solving linear programs