I believe you want to increment ptr by sent, here? Or else you need to move it some other way.