Fixed some trapezoidulation bugs