Fix git detection & clean up