Bug fixes and some minor new features