added an alert error in the connection function.