fixed bugs and added some new features