Fixes #8

Added changes made by @Serjinis in #8 . Just created a pull request, so it's easier to merge.

Fixes problems with offline reporting and cache being nil.