Fix LinearConstraintOptimizer in Scala and add smaller fixes here and there.