fixed bugs  and add example