Added some checks to prevent race conditions when connecting to WebOSTVService