add some features and trying to fix bug