adding commonjs wrapper functionality, handling bad js parse