Fixed a few bugs and added more offline checks.