Moved the disconnect message inside the null check