convert modules to immutable form