Improve error checking during replay (with a few clean-ups).
Merge pull request #207 from cgjones/better-checking

Improve error checking during replay (with a few clean-ups).