fix crash in generateAMDModule(): sync it with the other generators' code