update buffer and program