Fixes issue #8

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