Added check for loaded modules as well as a test for the check