A few fixes and enhancements