changed from exit() to sys.exit()