option handling fixes; draft of sd_diag output handling