fixing port handling