Store reference to callback function in output object, not io object.

Better fix for issue #2