Use module.main instead of module.parent

This patch replaces the `module.parent` check with the equivalent check using `module.main`. It [seems](http://nodejs.org/api/modules.html#modules_accessing_the_main_module) that this is the preferred way to do this in Node, and in Browserify, `module.parent` doesn't exist at all.