Fix a bug where reading back a 0 sized buffer could return null.