diff --git a/config/service_config.go b/config/service_config.go
index 832430a9c048c15f57c284137258b4fd3e512a83..f45e78cd63755170ead0b54a1d9b559e87e1ab11 100644
--- a/config/service_config.go
+++ b/config/service_config.go
@@ -111,7 +111,7 @@ func NewServiceConfig(id string, context context.Context) *ServiceConfig {
 func getRandomPort(protocolConfigs []*ProtocolConfig) *list.List {
 	l := list.New()
 	for _, proto := range protocolConfigs {
-		if proto.Port != "" {
+		if len(proto.Port) > 0 {
 			continue
 		}
 
@@ -162,7 +162,7 @@ func (c *ServiceConfig) Export() error {
 
 		port := proto.Port
 
-		if proto.Port == "" {
+		if len(proto.Port) == 0 {
 			port = nextPort.Value.(string)
 			nextPort = nextPort.Next()
 		}