more error checking. Takes care of the weirdness of some solvers.
Made the output template spec more flexible, for convenience
Authored by: "kifer" 2019-03-16
Parent: [r9582]
Child: [r9584]