fix key generate