fix off-by-one error in pascal string implementation