fix bugs and add some options