Fix the error of keyLength judgment