Avoid reassing module.exports on CommonJS modules

Fixes #947