better port handling for local development