fix bug when endpoint URL has no port defined