Various small fixes and enhancements