added examples in index html
fixing errors handling