change to detect status code
handle status code instead