Minor bug fixes and enhancements