updated frame connection logic