fix off-by-one
remove trailing whitespace