Fix captured output

Fixes #229