bug fix, writing encrypted files