Fixed API module to always use the raw format and json in case an error occurs.