Fix output format detection to be more strict again

and also `-f` should override detection