Bug fix
New version with a global reference for the buffering