fix when IO::Scalar is OUTPUT argument
Slightly simplify ref test for $newOutput.
Fix bug where output is an IO::Scalar.