Fixed JS error when offline.