XSS security fix
Improved backup var validation