some speedup in invalidate_deps