fix chunking bug

This fixes a chunking bug identified by @jakebolewski in #178.