fix out and input buffer write error