Fixed default port assignment bug in api server