Fix write extra data bug