Added +1 to expected size of char buffer for matrix writing