Validate port before referencing