fixed crash in encrypt