Corrected the keymem cleanup.