improve width measurement in adjust function