check if buf is empty