fixed examples and some bugs