Fixing runtime error when "module" is undefined

A variable must be defined in order to use in an "if".