moving encryption updated control check to inside the begin/rescue block