numerous bug fixes and enhancements