fix a bug with encrypting a file