bug fixs and enhancements