add select_output_mode() + minor cast fix