implement autofac for dependency injection. still has a bug