adding detect connection