only manupulate the buffer if we have data