Fixed NullReferenceException when using InjectionFactory