removed debug sys.exit() at beginning