fix using uninitialized buffer