fixed ajax error conditions