fix encryption bug