added keylen check