sensitivity analysis and some small code fixes