various minor bug fixes and enhancements