invalid syntax exceptions, bom removal and tweaks