various fixes and enhancements submitted by Roger.