buffer undef fixes