fixed bug in connection error handler