Issue #10: Fixed a bug that buffer is null