Fixed crash bug when there is no connection.