fix bugs and add features