use flush callback
flush only not empty buffers