made assert_modules more robust