Minor fixes
Several bugs fixed and enhancements
adjusts
fix merge