Properly concatenate large files read from stdin

See #564.
Great catch!