Fixed some dependency injection problems