Fix key generate