IR compensation in potentiostat