use sys.exit and use better exit code