simplify and fix an edge case in project cache