fixed bug in checkResponseCode