Fixed encryption error and crash