Security fix and some enhancements