Security enhancements and some small bug fixes.