fixes SYNPY-167 - error in cache on unfetched external urls.
Refactor to shorten.
Merge pull request #181 from larssono/fix_SYNPY167

Fix synpy167