improve checkConnect()