replaced exit with sys.exit (problem with solaris)