fixed CBC mode and wrote tests