optimize idb init method
make code a little more robust
fix gh-pages, merge master