Make module system much more robust