fix env var for long options with '-' in the name, add debug logging