adding a null check for module loader
more null checks and moving around of null checks