add missing check for connection error