Fixes #13: added calls to isConnecting to prevent double connection attempts