Moved buf append to avoid overflows