only clean up if not done already
fix bug where key gets deleted