security and sanitization improvements