changed error in connection logic