bug fixes and some new features