fixed some bugs and added some features