fixing minor bug when error 500 in XmlHttpRequest