fix a couple bugs about cleaning up dynamically loaded files and browserify autorun