added correct port handling