safecompile changes and fixing html errors