fixed handling connection error