Fixing dynamic width calculation for positioning tabs