Fixed bug in setting of removeKeyOnExit.