fixed a small logic in computing max width