Fixed QuadraticConstraint and added second derivative.