escaping variblaes inside functions
replaced html_entity_decode by api_html_entity_decode