fixed connection function