Tentative modifications to upstream QuantLib, committed here for review.