handling encryption state changes better