replaced hard-coded buffer length with correct variable, fixes #37