Add port to endpoint if passed custom port

Closes issue #168.