some enhancements and fixes