Fixed an error where OptimalSize returns the minimum value for strings ending in whitespace.