Small bug fixes and enhancements