fixing sys.exit calls