add new features and fix bug