improve CommonJS detection