Added connection checks