Fix bug in how modules are looked up internally