Added connection check/failsafe