Fix bug that caused app to crash without internet connection