Cleanup previous DB remnants before creating a new one
Merge from upstream current key registering code