fix builder for debug, better undef checks