terminate buffer with null