Fix crash bug when generating IDEA modules

This was a long existing bug but was exacerbated by 1.5.8 release
2 files changed