add some features and fix bugs