Added safety check for modules.