Fixed null pointer fault when connection failed