Fix nasty IO chunking bug.

Closes #8.