When you then later call refresh_blog_details to clear up the cache for the blog_id the cached -1 is passed to clean_blog_cache which then tries to get a blog_id from the object that was returned and doesn't get the right one and the cached are not deleted.