fixed mcrypt method for generating IV