Dangling pointer in output callback

resolves issue #5