fix dynamic width calculation