More bug fixes and enhancements