Fix incorrect check for error
Fix git double pulling when cache is stale