fix on error handling on ajax requests