fix html entities handling