adapted setup_port to old, clean state