improved ajax error handler