Fix module existence checking