fix updating dependency trees when changin a name. Including invalidating cache when 
necessary