added crude ajax error detection