Update index.js

tree flatten fix
Merge pull request #3 from EggDice/master

Tree flatten fix