The replaceDependency method returns a new object instead of modifying the current one, causing instability.