minor fixes
slightly bigger buffer, fix a local ref overflow