Fix a bug in which key was overwritten