fixed double encoding in some circumstances
fixed htmlspecialchars