fixing maxlength bug. fixes #78