Fix getopt and log