Added logging and handled RPC connection error