Explain why need to check for buffer valid.