fixed bugs and add library