add a bit more error checking to module loader