Added better Exception handling to the API (related: fixed backend issue with invalid XML characters)