tempbuf is not a global anymore