fix issues with iv calculation