Small bug fix in connecting