debug and fix encrpty