XSS attack prevention and few fixes