Fix dependency injection problems