fix width calculation issue