some fixes and enhancements