moved encryption mode detection from init to local methods