Fixed a horrible buffer length bug.