fix fix_key_lengh(), from Gao Chunhui