refine the API of input buffer (avoid NULL checks within the user code)