change BUFFLEN to MESSLENGTH