more improvements on encryption