bug fixes and minor enhancements