bugfix when adding 0 bytes : was instead adding the whole buffer