.......PS. [ZBX-9088] added buffer clean up function and made buffer global