I think this change here is all that is needed to fix the bug? The fact we got an exception for this
bug was a good thing. So I don't want to add extra validation in on_data unless absolutely needed.