fixes. generate iv once