Fix the module validity check