Fix double-exit bug.