Check connection status when trying to communicate with the server
Bugfix on ios7