fixed a bug with empty chunks at flush time