fixed contraints. midpoint example works now