Fix a bug to get width correctly