Move initializations after initial checks to avoid initializing when the values (Zoom, coordinates, ...) are not correct.

This fix an issue where isBackgroundCaching always returns true even if the background caching is not running.