Should this be if len(args) > 2, since you're using args[0], args[1], args[2]?