handle ajax errors properly