Fix some bugs with auto-selecting an output if none selected, and
generally do it in a saner way...