don't assign factory to 'root' before returning on AMD instantiation