Added improved debugging output in the case of errors. This closes #39. Also updated testfiles to the ones using hexadecimal representation of buffer contents.