Some enhancements, bug fixes