Added enough space for the initialization vector computation
Fixed incorrect computation of the IV