Adding os.path.basename to filename in keygen.