Improved XXS protection and a few errors fixed